package com.trkj.dao.jpa;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.JlIccard;


public interface IjliccardDAO extends CrudRepository<JlIccard, Long> {
	//查找所有IC卡信息
	@Query("select s from JlIccard s ")
	public List<JlIccard> findStuByPage(Pageable pageable);
	@Query("select s from JlIccard s where s.iId=?1")
	public List<JlIccard> queryicTopage(Pageable pageable,long iId);
	@Query("select s from JlIccard s where iSex=?1")
	public List<JlIccard> findBySex(String sex); 
	
	@Query("select s from JlIccard s where iName=?1")
	public List<JlIccard> findbyname(String sex);
	
	@Query("select s from JlIccard s where iAddress=?1")
	public List<JlIccard> findbyaddres(String sex);
	
	@Query("select s from JlIccard s where iIdentityCard=?1")
	public List<JlIccard> findbyiccar(String sex);
	
	@Query("select s from JlIccard s where iId=?1")
	public List<JlIccard> findbyregic(long sex);
	//返回最大的编号
	@Query("select max(iId) from JlIccard")
	public Long findMaxStuByPage();
	//根据身份证号返回卡号
	@Query("select iId from JlIccard  where iIdentityCard=?1")
	public long findbyid(String sex);
	@Query("select iName from JlIccard  where iId=?1")
	public String findbyname(Long iId);
	@Query("select iId from JlIccard  where iName=?1")
	public Long nametoic(String name);
	@Query("select iId from JlIccard  where iIdentityCard=?1")
	public Long iccardtoic(String iIdentityCard);
}
